package cn.lnl.springcloud.controller;

import cn.lnl.springcloud.entities.CommonResult;
import cn.lnl.springcloud.entities.Payment;
import cn.lnl.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author LNL
 * @date 2021/8/16 22:17
 */
@RestController
@Slf4j
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;


    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentById (@PathVariable("id") Long id) {
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping(value = "/consumer/payment/feign/timeout")
    public String paymentFeignTimeOut () {
        //openfeign-ribbon, 默认是1秒钟
        return paymentFeignService.paymentFeignTimeOut();
    }



}
